package org.scau.studentevaluation.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.scau.studentevaluation.config.global.log.WebLog;
import org.scau.studentevaluation.entity.dos.OrganizationDO;
import org.scau.studentevaluation.entity.dos.UserDO;
import org.scau.studentevaluation.entity.query.UserQuery;
import org.scau.studentevaluation.entity.vo.UserVO;
import org.scau.studentevaluation.service.IUserService;
import org.scau.studentevaluation.service.ImportMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @Author: x1aolone
 * @Date: 2020/8/19 16:07
 */
@Slf4j
@RestController
@Api("User控制器")
@WebLog("User控制器")

public class UserController {
    // Controller -> Service -> DAO
    @Autowired
    private IUserService userService;

    @ApiOperation("查询")
    @GetMapping("/findUser/{userId}")
    public UserDO findUser (long userId) {
       /* String college = userService.findUser(userId);
        if(college == null) {
            // 数据库里面没有的话，统一返回学院
            college = "学院";
        }*/
        return userService.getUserData(userId);
    }

    @ApiOperation("新增用户信息")
    @PostMapping("/insertUserData")
    public int insertUserData(UserQuery userQuery){
        return userService.insertUserData(userQuery);
    }

    /*
    @GetMapping("/findeUser/{studentId}")
    public UserDO findeUser(long studentId){
        return userService.getUserData(studentId);
    }

     */
}
